package com.ilongsay.dao;

import com.ilongsay.entity.ChaiFenSetting;
import com.ilongsay.entity.ErrorAdjust;
import com.ilongsay.entity.LimitType;
import com.ilongsay.entity.Setting;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author ilongsay
 * @Email ilongsay@163.com
 * @Copyright 版本所有，侵权必究！
 * @Datetime 2018-12-09 22:05
 * @Describution
 */
public interface SettingDao {

    @Select("select * from chaifensetting")
    public ChaiFenSetting findChaiSetting();

    public void updateChaiSetting(ChaiFenSetting setting);

    public Setting querySetting();

    @Update("update typelimit set 'limit'=#{limit},'select'=#{select} where type=#{type}")
    public void updateSetting(LimitType limitType);

    @Select("select * from typelimit where type=#{type}")
    public LimitType queryLimitSetting(@Param("type")String type);

    @Update("update settings set 'skr'=#{skr},'fhr'=#{fhr},taxRate=#{taxRate},code=#{code} where id=1")
    public void updateSysSetting(Setting setting);

    /**
     * @param
     * @return java.util.List<com.ilongsay.entity.LimitType>
     * 查询限额
     */
    @Select("select * from typelimit")
    public List<LimitType> queryLimit();

    /**
     * @param
     * @return com.ilongsay.entity.ErrorAdjust
     * 查询误差调整的数据，id固定为1，进行前端的表单回显，以后要重新改动按用户的名称进行调整
     */
    public ErrorAdjust queryErrorAdjust();

    public void updateErrorAdjust(ErrorAdjust errorAdjust);

    @Update("update fixError set fixType=#{fixType} where id = #{id}")
    public void updateFixError(@Param("fixType") String fixType,@Param("id") Integer id);
}
